package net.mysoft.framework.i18n;

import java.util.Hashtable;
import java.util.Locale;
import java.util.Map;

import org.apache.struts2.ServletActionContext;

public class Locales {
	private static Map<String, Locale> locales = null;
	static {
		locales = new Hashtable<String, Locale>(2);
		locales.put("American English", Locale.US);
		locales.put("Simplified Chinese", Locale.CHINA);
	}
	public static Locale getDefaultLocale() {
		return Locale.CHINA;
	}

	public static Map<String, Locale> getLocales() {
		return locales;
	}
	
	public static Locale getLocale(){
		Object o = ServletActionContext.getRequest().getSession().getAttribute("WW_TRANS_I18N_LOCALE");
		if(o!=null){
			return (Locale)o;
		}
		return getDefaultLocale();
	}
}
